import {Component, Input, OnInit} from '@angular/core';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import {EntryModalComponent} from '../../../views/staffsComponents/personnelchanges/components/entry-modal/entry-modal.component';

@Component({
  selector: 'app-entry-table',
  templateUrl: './entry-table.component.html',
  styleUrls: ['./entry-table.component.less']
})
export class EntryTableComponent implements OnInit {

  @Input() entryState: string;
  @Input() sendOfData;

  // tslint:disable-next-line:max-line-length
  listOfData: { nowPosting: string; skay: number; phone: string; sex: string; name: string; nowDepartment: string; id: string; time: string; posting: string; department: string; operationPerson: string; email: string }[] = [];


  constructor(private modal: NzModalService) { }

  ngOnInit(): void {

  }

  // 点了办理入职的按钮
  goWork(data): void {
    let title = '';
    if (this.entryState === '1') {
      title = '办理入职';
    }else if (this.entryState === '2') {
      title = '办理转正';
    }else if (this.entryState === '3') {
      title = '办理离职';
    }else {
      title = '职位异动';
    }
    data.title = title;
    // @ts-ignore
    const entryModal = this.modal.create({
      nzTitle: title,
      nzContent: EntryModalComponent,
      nzFooter: null,
      nzMask: false,
      nzComponentParams: { // 传参数
        entryData: data,
        entryState: this.entryState,
      },
    });
    entryModal.afterClose.subscribe((data) => {
      this.sendOfData = [...data];
    });
  }

}
